<% unless @milestones.size > 0 %>
	<% title t(:milestone, :count => 0) %>
	
	<div class="alert green center rounded-8 shadow-low">
		<h1><%= link_to t(:new, :scope => :milestone), new_project_milestone_path(@project) %></h1>
		<p><%= t :has_no_milestones, :scope => :milestone %></p>
	</div>
	
<% else %>

<%= title t(:milestone, :count => 0) %>

	<%= render "table", :label => t(:late, :count => 0, :scope => [:milestone, :status]),
						:description => t(:late, :scope => [:milestone, :status, :descriptions]),
						:milestones => @late if @late.size > 0 %>
						
	<%= render "table", :label => t(:pending, :count => 0, :scope => [:milestone, :status]),
						:description => t(:pending, :scope => [:milestone, :status, :descriptions]),
						:milestones => @scheduled if @scheduled.size > 0 %>
												
	<%= render "table", :label => t(:completed, :count => 0, :scope => [:milestone, :status]),
						:description => t(:completed, :scope => [:milestone, :status, :descriptions]),
						:milestones => @completed if @completed.size > 0 %>
												
	<%= render "table", :label => t(:unscheduled, :count => 0, :scope => [:milestone, :status]),
						:description => t(:unscheduled, :scope => [:milestone, :status, :descriptions]),
						:milestones => @unscheduled if @unscheduled.size > 0 %>

<% end %>

<% content_for(:subtabs) do %>
	<%= render "milestones/navigation/index_subtabs" %>
<% end %>

<% content_for :sidebar do %>
	<p class="center"><%= link_to content_tag(:span, t(:new, :scope => :milestone), :class => "icon add"), new_project_milestone_path, :class => "awesome large" %></p>
	
	<% @upcoming.sort_by(&:first).each do |month, milestones| %>
	
		<p class="title lightest rounded-4"><%= t(:month_names, :scope => :date)[month.strftime("%m").to_i] %></p>
		
		<dl class="icon-list">
		<% milestones.each do |milestone| %>
			<dt <%= "class='icon #{milestone.late? ? 'attention' : 'page-white-stack'}'" %>><%= link_to milestone.title, project_milestone_path(@project, milestone) %></dt>
			<dd><%= l milestone.due, :format => :long %><%= content_tag :b, " (#{t(:late, :scope => [:milestone, :status], :count => 1).downcase})" if milestone.late? %></dd>
		<% end %>
		</dl>
	<% end %>
<% end %>